<template>
	<view>
		<view class="header status_bar" :class="scrrol == true ? 'scrrolHeader' : ''">
			<view class="back iconfont icon-xiangzuo1" @tap="backPage"></view>
			<view class="text" :class="scrrol == true ? 'scrrolHeader' : ''">我的求购</view>
		</view>	
		<view class="bg_box">
			<image class="bg01" :src="getImgSrc('/static/bg05.png')" mode="widthFix"></image>
			<view class="bg_content">
				<block v-for="(item, index) in info">
				<view class="car_box">
					<view class="car_list">
						<view class="car_text">
							<!-- <view class="title">{{item.title}}</view> -->
							<view class="text">{{item.content}}</view>
							<!-- <view class="card">
								<view class="t">闽</view>
								<view class="n">A32738</view>
							</view> -->
						</view>
						<view class="car_img">
							<image :src="item.images" mode="widthFix"></image>
						</view>
					</view>
					<view class="other_box">
						<view class="btn" v-if="item.status == 0">审核中</view>
						<view class="btn01" v-else-if="item.status == 1">已通过</view>
						<view class="btn02" v-else >未通过</view>
						<view class="other" @click="del_want(index)">
							<view class="i iconfont icon-changyonggoupiaorenshanchu" ></view>
							<view class="t">删除</view>
						</view>
						<view class="other" :data-url="'/pages/service/publish02_edit?id='+item.id" @click="gotopage">
							<view class="i iconfont icon-bianji"></view>
							<view class="t">编辑</view>
						</view>
					</view>
				</view>
				</block>
				<block v-if="empty_show">
					<view style="text-align: center;padding-top: 5vw;margin-bottom: 5vw;">
						<u-empty text="没有更多了" mode="list">没有更多了</u-empty>
					</view>
				</block>
				<view class="clear_box04"></view>
				

			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page:1,
				scrrol:false,
				info:'',
				empty_show:1,
			}
		},
		onLoad() {
			this.loadData();
		},
		methods: {
			setRule(e){
				let that = this;
				let index = e.currentTarget.dataset.index;
				that.flowList[index].tick = !that.flowList[index].tick
			},
			loadData() {
				let that = this;
				that.Net._get('auth/member/my_want_list', {}, res => {
					if (res.code == 1) {
						that.info = res.data;
						if (that.info.length == 0){
							that.empty_show = 1;
						}
					}
				});
			},
			del_want(idx){
				let that = this;
				uni.showModal({
				    title: '确认提示',
				    content: '是否确认删除',
				    success:(res) => {
				        if (res.cancel){
				            return false;
				        }
						uni.showLoading({
							title: '删除中'
						});
						let cid = that.info[idx].id;
						that.Net._post('auth/member/want_del_hand', {id:cid}, res => {
							if (res.code == 1) {
								that.Msg.Success('删除成功', res => {
									uni.hideLoading();
									that.info.splice(idx, 1);
								});
							}
						});
				    }
				});
			},
			backPage() {
				uni.navigateBack({});
			},
			gotopage(e) {
				let url = e.currentTarget.dataset.url;
				uni.navigateTo({
					url: url
				});
			},

		},
		onPageScroll: function(Object) {
			//console.log(Object.scrollTop); //实时获取到滚动的值
			if (Object.scrollTop > 28) {
				this.scrrol = true;
				/* #ifdef APP-PLUS */
				/* #endif */
			} else if (Object.scrollTop < 28) {
				this.scrrol = false;
				/* #ifdef APP-PLUS */
				/* #endif */
			}
		},
		onReachBottom() {
			var that = this;
			that.page++;
			that.Net._get('auth/member/my_want_list', {per_page:'10',page:that.page,}, res => {
				if (res.code == 1) {
					if (res.data == '') {
						uni.showToast({
							title: '没有更多了',
							duration: 2000,
							icon: 'none'
						});
						that.empty_show = 1;
					} else {
						that.info = that.info.concat(res.data); //将数据拼接在一起
					}
				} else if (res.code == 0) {
					that.Msg.Success(res.msg, res => {});
				}
			});
		},
	}
</script>

<style>
	
	.header{
		background-color: transparent !important;
	}
	
	.header .text{
		background-color: transparent !important;
		color: #333 !important;
	}
	
	.header .back{
		color: #333 !important;
	}
	
	.scrrolHeader{
		background-color: #F9E9E3 !important;
	}
	
	.bg_box{
		width: 100%;
		position: relative;
	}
	
	.bg_box .bg01{
		width: 100%;
	}
	
	.bg_box .bg_content{
		width: 92%;
		position: absolute;
		left: calc(50% - 46%);
		top: calc(13.5vw + var(--status-bar-height));
		z-index: 98;
	}
	
	.car_box{
		width: 100%;
		background-color: #fff;
		border-radius: 3vw;
		margin-top: 4%;
	}
	
	.car_list{
		display: flex;
		align-items: center;
		padding: 6vw;
	}
	
	.car_list .car_text{
		flex: 1;
		
	}
	
	.car_list .car_text .title{
		font-size: 5vw;
		color: #333;
		font-weight: bold;
	}
	
	.car_list .car_text .text{
		font-size: 3.2vw;
		color: #666;
		margin-top: 2vw;
	}
	
	.car_list .car_text .card{
		margin-top: 2vw;
		display: flex;
		align-items: center;
		height: 6vw;
	}
	
	.car_list .car_text .card .t{
		width: 6vw;
		height: 100%;
		border-radius: 1vw 0 0 1vw;
		background-color: #FC5E21;
		font-size: 3.2vw;
		color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.car_list .car_text .card .n{
		height: 100%;
		border-radius: 0 1vw 1vw 0;
		background-color: #FFF7F4;
		font-size: 3.2vw;
		padding: 0 2vw;
		color: #FC5E21;
		display: flex;
		align-items: center;
	}
	
	.car_list .car_img{
		width: 45vw;
		margin-left: 4vw;
	}
	
	.other_box{
		width: 100%;
		height: 13vw;
		display: flex;
		border-top: 1px solid #F3F3F3;
	}
	
	.other_box .other{
		flex: 1;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.other_box .other:nth-child(1){
		border-right: 1px solid #F3F3F3;
	}
	
	.other_box .other .i{
		font-size: 5vw;
		color: #B8B8B8;
		margin-right: 1vw;
	}
	
	.other_box .other .t{
		font-size: 3.8vw;
		color: #666666;
	}
	
	.btn{
		background-color: #FFEDDF;
		color: #FB7D10;
		height: 7vw;
		line-height: 7vw;
		text-align: center;
		font-size: 3.2vw;
		border-radius: 2vw;
		padding: 0vw 2vw;
		margin: 3vw;
	}
	.btn01{
		background-color: #E8F0FF;
		color: #1B66FF;
		height: 7vw;
		line-height: 7vw;
		text-align: center;
		font-size: 3.2vw;
		border-radius: 2vw;
		padding: 0vw 2vw;
		margin: 3vw;
	}
	.btn02{
		background-color: #FFE4E1;
		color: #FD4C38;
		height: 7vw;
		line-height: 7vw;
		text-align: center;
		font-size: 3.2vw;
		border-radius: 2vw;
		padding: 0vw 2vw;
		margin: 3vw;
	}
	
	
	
</style>
